<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>AngularJS&middot;Hello AngularJS</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.css">
    <style>
        .demo{
            margin-bottom:10px;
            border-bottom:1px solid #1b926c;
        }
        /*.navbar{*/
            /*border:1px solid #1b926c;*/
            /*background-color: #1fa67a;*/
        /*}*/

    </style>
</head>
<body>

 <div class="container">
     <div class="row">
         <nav class="navbar navbar-default navbar-static-top">
             <div class="container-fluid">
                 <div class="navbar-header">
                     <a class="navbar-brand" href="../index.html">首页</a>
                 </div>
                 <ul class="nav navbar-nav">
                    <li class="active"><a href="javascript:void(0)">Link</a></li>
                    <li><a href="javascript:void(0)">Link2</a></li>
                 </ul>
             </div>
         </nav>
     </div>
     <div ng-app="myApp">
         <div class="row demo" ng-controller="HelloController">
             <h3>Demo1</h3>
             <h5>输出：{{message}}</h5>
         </div>
         <div class="row demo" ng-controller="ClickController">
             <h3>Demo2:ng-click事件</h3>
             <button ng-click="add(1)" class="btn">add(1)</button>
             <a href="javascript:void(0)" ng-click="subtract(1)" class="btn btn-danger">subtract(1)</a>
             <h5>输出：<b>{{counter}}</b></h5>
         </div>
     </div>
 </div>
</body>
</html>
<script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.js" type="text/javascript"></script>
<script>
    var myApp=angular.module("myApp",[]);
    myApp.controller("HelloController",function($scope){
        $scope.message="Morning AngularJS";
    });
    myApp.controller("ClickController",function($scope){
       $scope.counter=0;
       $scope.add=function(amount){$scope.counter+=amount};
       $scope.subtract=function(amount){$scope.counter-=amount};
    });
</script>
